package com.ebelter.test01.module.dj8module;

import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.ebelter.test01.R;


public class Activity2 extends Activity {

    WebView webView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_2);
        webView=findViewById(R.id.webview);


        WebSettings settings = webView.getSettings();



        settings.setJavaScriptEnabled(true); //这里如果本地html引入了javascript那么需要把这个设置为true
        settings.setAllowFileAccess(true);

        settings.setDefaultTextEncodingName("utf-8"); //设置文本编码
        settings.setAppCacheEnabled(true);
        settings.setCacheMode(WebSettings.LOAD_DEFAULT);//设置缓存模式
        settings.setDomStorageEnabled(true);
        settings.setBuiltInZoomControls(true);
        settings.setSupportZoom(true);
        settings.setLoadWithOverviewMode(true);
        settings.setUseWideViewPort(true);
        settings.setLoadsImagesAutomatically(true);

        webView.setWebViewClient(new WebViewClient() {

            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                view.loadUrl(url);
                return true;
            }
        });

        webView.loadUrl("http://www.szzhichou.com/video/index.html");


    }
}
